import axios from 'axios'

const setAxiosHeaders = (token) => {
  axios.defaults.headers.common['Authorization'] = token
}

export const forget = (state) => {
  state.token = ''
}

export const remember = (state, token) => {
  state.token = token
}

export const setValid = (state, validity) => {
  state.isValid = validity
  if (validity === false) {
    setAxiosHeaders('')
  }
}
